package com.gong.datareceive.controller;

import java.io.IOException;
import java.net.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description
 * @Author gongchang
 * @Date 2021-08-15 14:24
 */
public class DataSendDemo {

    public static void main(String[] args) throws IOException {
        DatagramSocket socket = new DatagramSocket(55555);
        InetAddress ip = InetAddress.getByName("127.0.0.1");
        int port = 8888;
        Map map = new HashMap();
        map.put("grandid",480);
        map.put("equid",500);
        map.put("digital",300.4);
        map.put("time",new Date());
        //System.out.println(Integer.toBinaryString(50));
        DatagramPacket packet = new DatagramPacket(map.toString().getBytes(),map.toString().getBytes().length,ip,port);
        //System.out.println(map.toString());
        socket.send(packet);
    }
}
